#!/usr/bin/perl

use lib::abs qw( .. );
use JIP::ToolSet; # load my commonly-used modules in a single import

use English qw( -no_match_vars );
use Test::More tests => 8;

use_ok('Proc::Lock');
require_ok('Proc::Lock');

can_ok(
    'Proc::Lock',
    qw(
        new
        init
        lock
        unlock
        _lockFile
    )
);

{
    my $process = Proc::Lock->new( lock_file => './tratata.lock' );

    isa_ok( $process, 'Proc::Lock' );
    isa_ok( $process, 'Class::Base' );
    isa_ok( $process, 'Class::Accessor::Fast' );

    is( $process->_lockFile, './tratata.lock', '_lockFile accessor' );
}

{
    my $process;

    try {
        $process = Proc::Lock->new;
    }
    catch {
        like(
            $ARG,
            qr/^required parameter "lock_file" not defined at /,
            'lock_file failed'
        );
    };
}
